import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPersist from 'pinia-plugin-persistedstate';
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import * as Icons from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'virtual:svg-icons-register' // 必须先注册图标，否则无法识别图标组件
import SvgIcon from './components/SvgIcon/index.vue'


import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

import App from './App.vue'
import router from './router'


const app = createApp(App)

app.component('svg-icon',SvgIcon)

// 全局注册 Element Plus 图标
app.config.globalProperties.$icons=[]
for (const [key, component] of Object.entries(Icons)) {
  app.config.globalProperties.$icons.push(key)
  app.component(key, component)
}

const pinia = createPinia();
pinia.use(piniaPersist)//全局使用插件

app.use(pinia)
app.use(mavonEditor)
app.use(ElementPlus,{locale:zhCn})
app.use(router)
app.mount('#app')
